package logic

import (
	"context"
	"patient/patientrpc/models/mysql"

	"patient/patientrpc/internal/svc"
	"patient/patientrpc/patientrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type UserShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewUserShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserShowLogic {
	return &UserShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *UserShowLogic) UserShow(in *patientrpc.UserShowRequest) (*patientrpc.UserShowResponse, error) {
	// todo: add your logic here and delete this line

	var show mysql.User
	mysql.DB.Debug().Where("id=?", in.Id).Find(&show)
	return &patientrpc.UserShowResponse{
		Id:       int64(show.ID),
		Account:  show.Account,
		Password: show.Password,
	}, nil
}
